package cn.wit.test;

/**
 * 设计一个名为 Rectangle 的类表示矩形
 * 
 * @author 16604
 *
 */

public class Rectangle {
	private double width = 1; // 宽
	private double height = 1; // 高

	// 无参构造器
	public Rectangle() {

	}

	// 带参构造器
	public Rectangle(double width, double height) {
		this.height = height;
		this.width = width;
	}

	// 返回面积
	public double getArea(double width, double height) {
		return width * height;
	}

	// 返回周长
	public double getPerimeter(double width, double height) {
		return (width + height) * 2;
	}

	@Override
	public String toString() {
		return "Rectangle [width=" + width + ", height=" + height + ",Area=" + getArea(width, height) + ",Perimeter="
				+ getPerimeter(width, height) + "]";
	}

	public double getWidth() {
		return width;
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}

}
